home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
packet
/
terminal
/
top_152
/
src152.exe
/
rar
/
TOPCOPY.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-05-16
|
4KB
|
124 lines
{┌─────────────────────────────────────────────────────────────────────────┐}
{│ │}
{│ T. O. P. │}
{│ │}
{│ (T)he (O)ther (P)acket │}
{│ │}
{│ T O P C O P Y . P A S │}
{│ │}
{│ │}
{│ Filekopier-Routinen │}
{└─────────────────────────────────────────────────────────────────────────┘}
Procedure FileKopieren (* Var Zeile : String *);
Var i,i1,i2,
Anzahl : Integer;
fq,fz : File;
Quelle,
Ziel : String[80];
Hstr,
Wild : String;
FiFlag,
VerFlag : Boolean;
srec : SearchRec;
maxPuffer : Word;
Procedure Kopieren(von,nach : String);
Var rResult,
wResult : Word;
Attr : Word;
FTime : LongInt;
Begin
Assign(fq,von);
GetFAttr(fq,Attr);
SetFAttr(fq,$20);
Assign(fz,nach);
if ResetBin(fq,T) = 0 then
begin
GetFTime(fq,FTime);
if RewriteBin(fz,T) = 0 then
begin
Repeat
Blockread(fq,Page^,maxPuffer,rResult);
BlockWrite(fz,Page^,rResult,wResult);
Until Eof(fq);
SetFTime(fz,FTime);
FiResult := CloseBin(fz);
SetFAttr(fz,Attr);
end else dec(Anzahl);
FiResult := CloseBin(fq);
end else dec(Anzahl);
End;
Begin
if MaxAvail > maxNotChBuf then maxPuffer := maxNotChBuf
else maxPuffer := MaxAvail - 1024;
GetMem(Page,maxPuffer);
FillChar(Page^,maxPuffer,0);
Quelle := CutStr(Zeile);
Ziel := RestStr(Zeile);
FiFlag := PfadOk(1,Ziel);
VerFlag := PfadOk(2,Ziel);
if FiFlag or VerFlag then
begin
if VerFlag then if Ziel[length(Ziel)] <> BS then Ziel := Ziel + BS;
Wild := '';
i := length(Quelle);
While (length(Quelle) > 0) and (Quelle[length(Quelle)] <> BS) do
begin
Wild := Quelle[i] + Wild;
delete(Quelle,length(Quelle),1);
dec(i);
end;
Anzahl := 0;
FindFirst(Quelle + Wild,AnyFile-Directory,srec);
While DosError = 0 do
begin
inc(Anzahl);
if VerFlag then
begin
Hstr := Ziel + srec.Name;
end else Hstr := Ziel;
if Hstr <> (Quelle + srec.Name) then Kopieren(Quelle + srec.Name,Hstr)
else dec(Anzahl);
Hstr := '';
FindNext(srec);
end;
str(Anzahl,Hstr);
Zeile := Hstr + B1 + InfoZeile(315);
end else Zeile := InfoZeile(316);
FreeMem(Page,maxPuffer);
End;
Procedure Delete_Datei (* Var Zeile : str80 *);
var Anzahl : Word;
f,fd : Text;
Hstr : String[80];
srec : SearchRec;
Begin
Anzahl := 0;
Hstr := Zeile;
While (length(Hstr) > 3) and (Hstr[length(Hstr)] <> BS)
do delete(Hstr,length(Hstr),1);
if Hstr[length(Hstr)] <> BS then Hstr := '';
FindFirst(Zeile,AnyFile-Directory,srec);
While DosError = 0 do
begin
Assign(fd,Hstr + srec.Name);
if EraseTxt(fd) = 0 then inc(Anzahl);
FindNext(srec);
end;
Zeile := int_str(Anzahl) + B1 + InfoZeile(35);
End;